home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-03-04 | 2.6 KB | 116 lines | [TEXT/ToyS] |
- -- User parameters
- property kasRemoteAppName : "◊ Voice Watcher"
- property sasMachine : "Kerr ◊ AKUA021 ◊ PM7166"
- property sasUser : "Beba"
- property sasPass : ""
- property sasZone : "*"
-
- property sasCheckEvery : 45 -- How many seconds between checks
- property sasStatMax : 911 -- Silly number sets max of status bar we display.
-
- -- Internal
- property sasStatus : ""
- property sasStatWind : 0
- property gasStatLoc : {0, 0}
- property sasStatVal : 0
- property sasStatAction : "…"
-
- property sasLastQuit : 0
-
-
- on run
- talk as user sasUser ¬
- with password sasPass ¬
- on server sasMachine ¬
- in AppleTalk zone sasZone
-
- set sasLastQuit to 0
-
- set sasStatus to "I can't get no…"
-
- set sasStatWind to (display info titled sasMachine ¬
- message sasStatus ¬
- using font ¬
- "Chicago" using size 12 ¬
- using color (15 * (2 ^ 0)) ¬
- located at gasStatLoc)
-
- -- set waitSecs to sasCheckEvery
- -- repeat while (waitSecs > 0)
- -- set waitSecs to idle {}
- -- pause for waitSecs with seconds timing
- -- end repeat
- end run
-
-
- on quit
- if (sasLastQuit is not -1) then
- asShowStatus("Quit, dammit!")
- set gasStatLoc to screen location of ¬
- (display info sasStatWind with disposal)
- end if
-
- set sasLastQuit to -1
- set sasStatWind to 0
-
- continue quit
- end quit
-
-
- on idle
- if sasLastQuit is -1 then return 0
-
- if (sasLastQuit is 0) then
- try
- «event ÅkuaTalK» kasRemoteAppName given «class TSrv»:sasMachine, «class TZon»:sasZone ¬
- , «class TUsr»:sasUser, «class TPwd»:sasPass
- set sasLastQuit to 1
- on error errStr
- asShowStatus(errStr)
- beep
- pause for 2 with seconds timing
- end try
- end if
-
- if sasLastQuit is 0 then
- asShowAction("LOST COMMUNICATION!")
- asShowStatus("LOST COMMUNICATION!")
- asShowAction("…")
- else
- try
- «event ÅkuaTalK» kasRemoteAppName given «class TSrv»:sasMachine, «class TZon»:sasZone ¬
- , «class TUsr»:sasUser, «class TPwd»:sasPass
-
- tell application kasRemoteAppName of machine sasMachine to get asStatus()
- set remoteStat to the result
-
- set sasStatMax to barMax of remoteStat
- set sasStatVal to barVal of remoteStat
- asShowAction(action of remoteStat)
- asShowStatus(Status of remoteStat)
- on error
- set sasLastQuit to 0
- end try
- end if
-
- return sasCheckEvery
- end idle
-
-
- on asShowStatus(Status)
- if (Status is not sasStatus) then
- set sasStatus to Status
- set gasStatLoc to screen location of ¬
- (display info sasStatWind message sasStatus)
- end if
-
- set sasStatVal to sasStatVal + 1
- if (sasStatVal > sasStatMax) then set sasStatVal to 1
- end asShowStatus
-
-
- on asShowAction(action)
- display info sasStatWind message action at line 2
- set sasStatAction to action
- end asShowAction
-